<script setup lang="ts">
// 获取屏幕安全区域
const { safeAreaInsets } = uni.getSystemInfoSync()
console.log(safeAreaInsets)
</script>

<template>
  <view class="navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
    <!-- <view class="logo">
      <image class="logo-image" src="@/static/images/logo.png" />
      <text class="logo-text">新鲜 亲民 快捷</text>
    </view> -->

    <!-- <view class="search">
        <uni-icons type="search" size="20" />
        <text class="icon-search">搜索商品</text>
        <text class="icon-scan"></text>
      </view> -->
    <view class="search-box">
      <!-- <image src="@/static/search/left.png" mode=""></image> -->
      <navigator url="/pages/search/search" open-type="navigate" hover-class="none">
        <view class="input-box">
          <uni-icons class="icon" type="search" size="20" />
          <input type="text" placeholder="搜索" placeholder-class="placeholder" />
          <!-- <image src="../../static/search/scan.png" mode=""></image> -->
        </view>
      </navigator>
    </view>
  </view>
</template>

<style lang="scss">
.navbar {
  position: relative;
  display: flex;
  flex-direction: row;

  // #ifdef MP-ALIPAY
  justify-content: start;
  height: 100rpx;
  padding: 30px 0 0 70rpx;
  padding-top: 20px;
  background-image: url(@/static/home/navigator_bg.png);
  // background-color: #90D7EC;
  background-size: cover;
  // #endif

  .logo {
    display: flex;
    align-items: center;
    height: 64rpx;
    padding-left: 30rpx;

    .logo-image {
      width: 166rpx;
      height: 39rpx;
    }

    .logo-text {
      flex: 1;
      padding-left: 20rpx;
      margin: 2rpx 0 0 20rpx;
      font-size: 26rpx;
      line-height: 28rpx;
      color: #fff;
      border-left: 1rpx solid #fff;
    }
  }

  .search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 55%;
    height: 64rpx;
    padding: 0 10rpx 0 26rpx;
    margin: 16rpx 20rpx;
    font-size: 28rpx;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 32rpx;
  }

  .icon-search {
    color: black;
    &::before {
      margin-right: 10rpx;
    }
  }

  .icon-scan {
    padding: 15rpx;
    font-size: 30rpx;
  }

  .search-box {
    display: flex;
    /* #endif */
    align-items: center;
    /*  #ifndef MP-WEIXIN  */
    justify-content: space-between;
    height: 44px;
    margin: 0 24rpx;
    image {
      flex-shrink: 0;
      width: 50rpx;
      height: 50rpx;
    }
    text {
      flex-shrink: 0;
      color: #999;
    }
  }

  .input-box {
    display: flex;
    align-items: center;
    /*  #ifndef MP-WEIXIN  */
    width: 100%;
    height: 72rpx;
    padding: 0 30rpx;
    /* #endif */
    margin: 0 24rpx;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 72rpx;

    .icon {
      opacity: 0.5;
    }
    input {
      width: 100%;
      font-size: 30rpx;
    }
    .placeholder {
      color: rgb(130, 130, 130);
    }
    image {
      width: 48rpx;
      height: 48rpx;
    }
  }
}
</style>
